/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.za.mbasa.desingPatters.Adapter;

/**
 *
 * @author 208155937
 */
public class TemperatureObjectreporter implements TemperatureInfo {

    CelciusReporter celciusReporter;

    public TemperatureObjectreporter() {
        celciusReporter = new CelciusReporter();
    }

    @Override
    public double getTemperatureInF() {
      return cToF (celciusReporter.getTemperature ());  
    }

    @Override
    public void setTemperatureInF(double temperatureInF) {
        celciusReporter.setTemperature (fToC( temperatureInF));
    }

    @Override
    public double getTemperatureInC() {
        return celciusReporter.getTemperature( );
    }

    @Override
    public void setTemperatureInC(double temperatureInC) {
        celciusReporter.setTemperature ( temperatureInC );
    }
    private double fToC(double f) {
        return ((f - 32) * 5 / 9);
    }
    private double cToF(double c) {
        return ((c * 9 / 5) + 32);
    }
}
